#ifndef KMC_H
#define KMC_H
#include "../Signal.h"




// ---------------------------------------------------
class plant_1DSOS_RDM:public block{
private:
	// Options
	int		LatticeSize;
	double	E_D;
	double	E_S;
	double	E_N;

	// Inputs
	double	T;
	double	W;

	// Monte Carlo Simulators
	MCSimulator* MC_Event;   // Randomly select a group with certain neighbors
	MCSimulator* MC_AdsorptionSite;
	MCSimulator* MC_MigrationSite;
	MCSimulator* MC_Neighbor;

	//States
	1DSurface*  surface;
	1DSpectrum* spectrum;
	
	k_m=2*temperature*KB2H;
	for(i=0;i<N_CL-1;i++)
	{
		MIGR_RT[i]=k_m*exp(-(E_S+i*E_N)*EV2KB/(temperature+0.0));
	}
    MIGR_RT[N_CL-1]=0;

	// Diagnosis
	double k_m2d;		// the ratio between desorption rate and the migration rate for the same site
	
	//
	void adsorption();
	void migration();
	void desorption();

	// Auxillary functions
	void init_migr_rate();
	void init_desorp_rate();
public:
	plant_1DSOS_RDM(double idt,int iL=100, int iMode = 50, double iE_s = 1.2, double iE_N, double iE_N=0.6);
	~plant_1DSOS_RDM();
	virtual void update(double sysTime);
	void reset();
	void getSnapshot(const string FileName);
	double getM2();
	double getR2();
	double getAutoCorrelationLength();
}
// ---------------------------------------------------

#endif